//
//  SWOrderPayIDFetchReq.swift
//  ChildStory
//
//  Created by linhan on 2017/1/19.
//  Copyright © 2017年 Aiya. All rights reserved.
//

import Foundation

class SWPurchaseRequisitionFetchReq: SWBaseRequest
{
    //凭借订单ID获取支付请求单，在凭支付ID获取第三方支付参数进行支付
    var orderID:String = ""
    
    override init()
    {
        super.init()
        api = SWRequestAPI.AddressCreate
    }
    
    override var url:String
    {
        return "http://mpic.bbyiya.com/order/getPayOrder"
    }
    
    override var params:Any?
    {
        return ["userOrderId":orderID]
    }
    
    override func JSONToModel(_ json:JSON, JSONString:String, JSONData:Data) -> AnyObject?
    {
        trace(json)
        return Mapper<SWPurchaseRequisitionFetchRsp>().map(JSONString: JSONString)
    }
}

class SWPurchaseRequisitionFetchRsp: NSObject,Mappable
{
    var statu:String?
    var requisition:SWPurchaseRequisitionRsp?
    
    
    required init?(map: Map) { }
    
    // Mappable
    func mapping(map: Map) {
        statu                   <- map["Statu"]
        requisition             <- map["BaseModle"]
    }
}

class SWPurchaseRequisitionRsp: NSObject,Mappable
{
    var orderID:String?
    var payID:String?
    var price:Double?
    var productID:Int?
    
    
    required init?(map: Map) { }
    
    // Mappable
    func mapping(map: Map) {
        orderID                  <- map["orderId"]
        payID                    <- map["payId"]
        price                    <- map["totalPrice"]
        productID                <- map["productId"]
    }
}
